﻿// -----------------------------------------------------------------------
// <copyright file="InversionConverter.cs" company="R&R">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

#region Imports
using System.Globalization;
using System.Windows.Data;
using System;
#endregion Imports

namespace Domino
{
    public class InversionConverter : IValueConverter
    {
        #region IValueConverter Members
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (targetType == typeof(Boolean))
            {
                bool bln = false;
                Boolean.TryParse(System.Convert.ToString(value), out bln);

                return !bln;
            }
            // else if () // add other types
            else throw new NotImplementedException(String.Format("{0} not defined for {1}", this.GetType().Name, targetType.ToString()));
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
        #endregion IValueConverter Members
    }
}
